#ifndef FSM_H
#define FSM_H

#include "Global.h"
#include "State_FixedStand.h"
#include "State_Passive.h"
#include "State_Troting.h"
#include "State_Fall.h"
#include "State_Walking.h"
#include "State_Jump.h"
#include "State_Jump2.h"
#include "State_JumpL.h"
#include "State_JumpL2.h"
#include "State_JumpR.h"
#include "State_JumpR2.h"

typedef enum
{
    NORMAL,
    CHANGE,
} FSMMode_e;

typedef enum
{
    PASSIVE = 1,    // 阻尼
    FALL = 2,       // 卧倒
    FIXEDSTAND = 3, // 固定站立
    FREESTAND = 4,  // 自由站立
    TROTING = 5,    // 对角步态
    WALKING = 6,    // 行走步态
    JUMP = 7,       // 跳跃
    JUMP2 = 8,      // 跳跃2
    JUMPL = 9,
    JUMPL2 = 10,
    JUMPR = 11,
    JUMPR2 = 12,
    //JUMPR2 = 12,
} FSMState_e;

typedef struct
{
    FSMMode_e mode;
    FSMState_e currentState;
    FSMState_e nextState;

    void (*enter)(void);
    void (*run)(void);
    void (*exit)(void);
} FSM_t;

extern FSM_t FSM;

void FSM_Init(FSMState_e state);
void FSM_Run(void);
void FSM_SetState(FSMState_e state);

#endif
